package com.zyw.security.shiro.web.authc.tk;

/**
 * 短信登录认证token
 *
 * @author zhangyw
 * @date 2018/1/25 9:17
 * @see `https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-login.html#wxloginobject` code 换取 session_key
 */
public class WXMiniAppsAuthcToken extends BasicAuthcToken {

    // input
    private String code; // js code

    // output
    private String openid;
    private String session_key;
    private String unionid; //

    public WXMiniAppsAuthcToken() {
    }

    public WXMiniAppsAuthcToken(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getSession_key() {
        return session_key;
    }

    public void setSession_key(String session_key) {
        this.session_key = session_key;
    }

    public String getUnionid() {
        return unionid;
    }

    public void setUnionid(String unionid) {
        this.unionid = unionid;
    }

    @Override
    public Object getPrincipal() {
        return getCode();
    }

    @Override
    public Object getCredentials() {
        return getCode();
    }
}
